import { Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
import { dateTransformer } from '../../../../common/utils';

@Entity('message_alarm', {
  comment: '消息报警表，存储因对话内容触发的各类报警信息',
})
export class AlarmEntity {
  @PrimaryGeneratedColumn({ type: 'int', name: 'id', comment: 'id' })
  public id: number;

  @Column({ type: 'int', name: 'user_id', default: null, comment: '用户ID' })
  public userId: number;

  @Column({ type: 'int', name: 'child_id', default: null, comment: '孩子ID' })
  public childId: number;

  @Column({ type: 'tinyint', name: 'alarm_type', default: null, comment: '报警类型（蓝色、红色、橙色等）' })
  public alarmType: number;

  @Column({ type: 'text', name: 'alarm_trigger_content', default: null, comment: '触发报警的对话内容' })
  public alarmTriggerContent: string;

  @Column({ type: 'char', name: 'del_flag', default: false, comment: '删除标志' })
  public delFlag: string;

  @CreateDateColumn({ type: 'datetime', name: 'create_time', default: null, transformer: dateTransformer, comment: '创建时间' })
  public createTime: Date;

  @UpdateDateColumn({ type: 'datetime', name: 'update_time', default: null, transformer: dateTransformer, comment: '更新时间' })
  public updateTime: Date;
}
